fix(ssd): stream the directory we load, resume partial first-run downloads, keep exiting events on their own line - #196
Merged
Conversation
…scope Follow-ups from the #192 review: - --stream-experts drops a resolved model directory that fails validation (an empty or partial snapshot), and the prefetch reuse check validates every shard instead of just config.json, so an interrupted download is resumed rather than planned with a partial size. - Load from the directory streaming was activated for, so a different lookup can't pick another copy that silently loads without streaming. - ProgressTracker.finish() ends the bar line when a download returns or throws, and emitEvent starts a fresh line if a bar is open, so the exiting event is never glued onto a progress line the daemon can't parse. - README: the b769/b773 crash covers quantized MoE models generally (reproduced with Gemma 4 26B-A4B too); re-measure the Gemma 4 8-bit --stream-experts row (9.1 tok/s, 9.5K ok, 32K swaps, 7.3 GB). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Real-time recording on the official b782 binary: 13.6 tok/s decode, 5.1 GB peak, no swap. Shown in the README's Qwen3.6 GPU vs SSD section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-ups from the SwiftLM review session's review of #192 (the owner OK'd them as post-merge work), plus one gap found while testing them.
Changes
loadWeightsstreams only when the loaded directory matches the one streaming was activated for.modelConfigand the streaming directory came from different lookups, so a model found only byresolveModelDirectory(for example~/.cache) got a second copy downloaded into Application Support and loaded without streaming. When--stream-expertsis set,modelConfignow points atmodelDirectory.resolveModelDirectorydoesn't check that the weights are present. An empty or partial~/.cachesnapshot (for example from an interrupted download) resolved as the model directory, so the prefetch was skipped and streaming was activated for a directory the loader would never read. With--stream-experts, a resolved directory that failsModelStorage.validateLocalModelDirectoryis now dropped.config.json. The architecture probe or an interrupted download can leave that behind, and the session then planned with a partial size. It now validates every shard, and otherwise resumes throughsnapshot.ProgressTracker.finish()stops redrawing and ends the\rline. It runs when the prefetch or the main load returns or throws.emitEventalso starts a fresh line if a bar is still open. Before, a mid-download failure glued theexitingJSON onto the progress line, where the Aegis daemon (serde_jsonper line) and the Electron manager (startsWith('{')) couldn't see it. This problem already existed for the loader's bar.broadcast_shapes (260,8,8,2816) vs (260,8,1)on b769. The Gemma 4 8-bit--stream-expertsrow predated fix: propagate throws from LanguageModel.newCache and adapt to mlx-swift-lm PR #62 #167, so I re-measured it: 9.1 tok/s (was 8.8), 9.5K tokens ok, 32K swaps, 7.3 GB. The data is appended todocs/profiling/m6/gemma4_26b_a4b_8bit.*.Verification (Mac mini M6, 32 GB)
config.jsonplus the tokenizer files. Before the directory-validation fix, run 2 skipped the prefetch, because an empty~/.cachesnapshot resolved as the model directory. With it, the next start re-downloads, finishes the bar with a newline, prints the next log line on a fresh line, and reaches ready. Run 3 reuses the Application Support copy without downloading.--stream-experts, 548 tokens: 248.6 prefill / 13.89 decode tok/s at 5.69 GB, with no "loading … without streaming" line. Streaming still activates for a cached model.--stream-expertson the fixed build: 16.75 / 17.01 tok/s decode at 548 / 2.3K tokens, 4.4–5.1 GB.emitEventnewline after a mid-download network failure wasn't reproduced; it's based on code reading.AI usage: written by Claude Code (Claude Opus 5.5) in the M6 benchmarking session, with the repo owner's approval to open this PR. The review findings came from the SwiftLM review session.
🤖 Generated with Claude Code